package com.example.data0303.adapter;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.app.Fragment;

import com.example.data0303.R;
//import androidx.fragment.app.Fragment;

public class DemoFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater,
                             @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
//        LayoutInflater.from(container.getContext());
        View rootView=inflater.inflate(R.layout.fragment_demo,container,false);
        rootView.findViewById(R.id.tv_demo_text).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.e("tag","dianji");
                getFragmentManager()
                        .beginTransaction()
                        .add(rootView.getId(),new Demo2Fragment())
                        .addToBackStack(null)
                        .commit();
            }
        });


//        return super.onCreateView(inflater, container, savedInstanceState);
        return rootView;
    }
}
